<%@page import="com.naszetatry.controller.RegistrationController"%>
<%@page import="com.naszetatry.registration.RValidation"%>
<%@ include file= "/html/header.html" %>
<div id="main">
	<% 
	if(UserController.isLogged(session)) {	
	%>
		<h1>Zmiana hasla:</h1>
		<%
		   RValidation rValidation = RegistrationController.getValidation(request);
		%>
		<form action="settings">
			<div class = "validationAccepted">
			<%
				if(rValidation.isPasswordChangedCorrectly)
					out.println(Message.SETTINGS_PASSWORD_VALID);
			%>
			
			</div>
			<table>
				<tr>
					<td>
	       				aktualne haslo:
	       			</td>
	       			<td>
	       				<input type="password" name="old_password"/>
	       			</td>
	       			<td>
	       				<div class = "validation">
						<%
							if(!rValidation.isPasswordValid)
							out.println(Message.INVALID_PASSWORD);
						%>		
						</div>
	       			</td>
	       		</tr>
	       		
	       		<tr>
	       			<td>		
	       				nowe haslo:
	       			</td>
	       			<td>
	       				 <input type="password" name="new_password1"/>
	       			</td>
	       			<td>
	       				<div class = "validation">
						<%
							if(!(rValidation.isPasswordMatch))
							out.println(Message.NOMATCH_PASSWORD);
						%>		
				</div>
	       			</td>
	       		</tr>
	       		<tr>
	       			<td>		
	       				powtorz haslo:
	       			</td>
	       			<td>
	       				 <input type="password" name="new_password2"/>
	       			</td>
	       		</tr>
	       	</table>		 
	       	<input type="submit" value="zmien"/>
	       				
	       
	    </form>
	<% 	
    }
	else
		out.println(Message.NOTLOGGED);
	%>	    
</div>

<%@ include file= "right.jsp" %>

<%@ include file= "/html/footer.html" %>


